<template>
  <div class="home-container">
    <!-- 主要内容区域 -->
    <div class="main-content">
      
      <!-- 顶部欢迎区域 -->
      <div class="welcome-section">
        <div class="welcome-content">
          <h1 class="welcome-title">
            欢迎使用 <span class="highlight">AI工具集</span>
          </h1>
          <p class="welcome-subtitle">
            让AI成为您的创作伙伴，探索无限创意可能
          </p>
          <div class="stats-row">
            <div class="stat-item">
              <div class="stat-number">10,000+</div>
              <div class="stat-label">图片生成</div>
            </div>
            <div class="stat-item">
              <div class="stat-number">5,000+</div>
              <div class="stat-label">视频创作</div>
            </div>
            <div class="stat-item">
              <div class="stat-number">8,000+</div>
              <div class="stat-label">智能处理</div>
            </div>
            <div class="stat-item">
              <div class="stat-number">99.9%</div>
              <div class="stat-label">满意度</div>
            </div>
          </div>
        </div>
        
        <!-- 个人信息卡片 -->
        <div class="profile-card">
          <div class="avatar-container">
            <div class="avatar">
              <img src="https://via.placeholder.com/120/8B5CF6/FFFFFF?text=陈" alt="头像" />
              <div class="avatar-status">
                <div class="status-dot"></div>
                <span>在线</span>
              </div>
            </div>
          </div>
          <div class="user-info">
            <h3 class="user-name">陈祥禧</h3>
            <p class="user-title">AI工具开发者</p>
            <div class="user-tags">
              <span class="tag">Vue.js</span>
              <span class="tag">TypeScript</span>
              <span class="tag">AI集成</span>
              <span class="tag">图像处理</span>
              <span class="tag">UI/UX设计</span>
            </div>
            <div class="contact-info">
              <div class="contact-item">
                <span class="contact-icon">📧</span>
                <span>chenxiangxi@ai-tools.com</span>
              </div>
              <div class="contact-item">
                <span class="contact-icon">💼</span>
                <span>github.com/chenxiangxi</span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 功能模块展示 -->
      <div class="features-section">
        <h2 class="section-title">产品功能</h2>
        <div class="features-grid">
          
          <!-- AI图像生成 -->
          <div class="feature-module">
            <div class="module-header">
              <div class="module-icon">🎨</div>
              <h3 class="module-title">AI图像生成</h3>
              <span class="module-badge">热门</span>
            </div>
            <p class="module-description">
              强大的AI图像生成工具，支持文字生成图片、图片转换图片、图片生成视频
            </p>
            <div class="module-preview">
              <div class="preview-image">
                <div class="preview-placeholder">
                  <div class="preview-icon">🖼️</div>
                  <span>预览效果</span>
                </div>
              </div>
            </div>
            <div class="module-features">
              <div class="feature-tag">文生图</div>
              <div class="feature-tag">图生图</div>
              <div class="feature-tag">图生视频</div>
            </div>
            <div class="module-actions">
              <button class="action-btn primary" @click="navigateTo('/text-to-image')">
                开始创作
              </button>
              <button class="action-btn secondary" @click="showDemo('image-gen')">
                查看示例
              </button>
            </div>
          </div>

          <!-- 万物迁移 -->
          <div class="feature-module">
            <div class="module-header">
              <div class="module-icon">✨</div>
              <h3 class="module-title">万物迁移</h3>
              <span class="module-badge new">最新</span>
            </div>
            <p class="module-description">
              智能图像处理工具，实现图片智能剪辑、扩图和服装迁移等功能
            </p>
            <div class="module-preview">
              <div class="preview-image">
                <div class="preview-placeholder">
                  <div class="preview-icon">🔄</div>
                  <span>处理效果</span>
                </div>
              </div>
            </div>
            <div class="module-features">
              <div class="feature-tag">智能剪辑</div>
              <div class="feature-tag">图片扩图</div>
              <div class="feature-tag">服装迁移</div>
            </div>
            <div class="module-actions">
              <button class="action-btn primary" @click="navigateTo('/smart-crop')">
                立即体验
              </button>
              <button class="action-btn secondary" @click="showDemo('transform')">
                查看示例
              </button>
            </div>
          </div>

          <!-- AI故事视频 -->
          <div class="feature-module">
            <div class="module-header">
              <div class="module-icon">🎬</div>
              <h3 class="module-title">AI故事视频</h3>
              <span class="module-badge">推荐</span>
            </div>
            <p class="module-description">
              输入故事文案，AI自动润色并生成精彩的故事视频，支持多种风格
            </p>
            <div class="module-preview">
              <div class="preview-image">
                <div class="preview-placeholder">
                  <div class="preview-icon">🎭</div>
                  <span>视频预览</span>
                </div>
              </div>
            </div>
            <div class="module-features">
              <div class="feature-tag">文案润色</div>
              <div class="feature-tag">视频生成</div>
              <div class="feature-tag">多种风格</div>
            </div>
            <div class="module-actions">
              <button class="action-btn primary" @click="navigateTo('/ai-story-video')">
                创作视频
              </button>
              <button class="action-btn secondary" @click="showDemo('story-video')">
                查看示例
              </button>
            </div>
          </div>
        </div>
      </div>

      <!-- 最近使用和快速操作 -->
      <div class="quick-section">
        <div class="recent-works">
          <h3 class="section-subtitle">最近使用</h3>
          <div class="recent-grid">
            <div class="recent-item" v-for="item in recentWorks" :key="item.id">
              <div class="recent-thumbnail">
                <img :src="item.thumbnail" :alt="item.title" />
                <div class="recent-overlay">
                  <button class="overlay-btn" @click="continueWork(item)">继续编辑</button>
                </div>
              </div>
              <div class="recent-info">
                <h4 class="recent-title">{{ item.title }}</h4>
                <p class="recent-time">{{ item.time }}</p>
                <span class="recent-type">{{ item.type }}</span>
              </div>
            </div>
          </div>
        </div>

        <div class="quick-actions">
          <h3 class="section-subtitle">快速开始</h3>
          <div class="quick-grid">
            <div class="quick-item" @click="navigateTo('/text-to-image')">
              <div class="quick-icon">🎨</div>
              <span class="quick-text">文生图</span>
            </div>
            <div class="quick-item" @click="navigateTo('/smart-crop')">
              <div class="quick-icon">✂️</div>
              <span class="quick-text">智能剪辑</span>
            </div>
            <div class="quick-item" @click="navigateTo('/ai-story-video')">
              <div class="quick-icon">🎬</div>
              <span class="quick-text">故事视频</span>
            </div>
            <div class="quick-item" @click="openWorkspace">
              <div class="quick-icon">📁</div>
              <span class="quick-text">我的作品</span>
            </div>
          </div>
        </div>
      </div>

      <!-- 产品特色 -->
      <div class="highlights-section">
        <h2 class="section-title">为什么选择我们</h2>
        <div class="highlights-grid">
          <div class="highlight-item">
            <div class="highlight-icon">⚡</div>
            <h4 class="highlight-title">高效处理</h4>
            <p class="highlight-desc">先进的AI算法，秒级生成高质量结果</p>
          </div>
          <div class="highlight-item">
            <div class="highlight-icon">🎯</div>
            <h4 class="highlight-title">精准控制</h4>
            <p class="highlight-desc">丰富的参数设置，精确控制创作效果</p>
          </div>
          <div class="highlight-item">
            <div class="highlight-icon">🔒</div>
            <h4 class="highlight-title">安全可靠</h4>
            <p class="highlight-desc">本地处理，保护您的创作隐私安全</p>
          </div>
          <div class="highlight-item">
            <div class="highlight-icon">🆓</div>
            <h4 class="highlight-title">免费使用</h4>
            <p class="highlight-desc">核心功能完全免费，无使用限制</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

defineOptions({
  name: 'HomePage',
});

const router = useRouter();

const recentWorks = ref([
  {
    id: 1,
    title: '科幻城市插画',
    thumbnail: 'https://via.placeholder.com/150/8B5CF6/FFFFFF?text=科幻',
    time: '2小时前',
    type: '文生图'
  },
  {
    id: 2,
    title: '人物背景移除',
    thumbnail: 'https://via.placeholder.com/150/10B981/FFFFFF?text=剪辑',
    time: '1天前',
    type: '智能剪辑'
  },
  {
    id: 3,
    title: '童话故事视频',
    thumbnail: 'https://via.placeholder.com/150/F59E0B/FFFFFF?text=视频',
    time: '3天前',
    type: '故事视频'
  }
]);

const navigateTo = (path: string) => {
  router.push(path);
};

const showDemo = (type: string) => {
  console.log('展示示例:', type);
  // 这里可以添加示例展示逻辑
};

const continueWork = (item: any) => {
  console.log('继续编辑:', item);
  // 这里可以添加继续编辑的逻辑
};

const openWorkspace = () => {
  console.log('打开工作区');
  // 这里可以添加工作区逻辑
};
</script>

<style scoped>
.home-container {
  padding: 2rem;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* 欢迎区域 */
.welcome-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 1rem;
}

.welcome-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-title {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.highlight {
  background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

/* 个人信息卡片 */
.profile-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  height: fit-content;
}

.avatar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.avatar {
  position: relative;
}

.avatar img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.avatar-status {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(16, 185, 129, 0.9);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #10f5a8;
  border-radius: 50%;
}

.user-info {
  text-align: center;
}

.user-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.user-title {
  font-size: 1rem;
  color: #718096;
  margin-bottom: 1rem;
}

.user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.tag {
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.contact-icon {
  font-size: 1rem;
}

/* 功能模块区域 */
.features-section {
  margin: 2rem 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 600;
  color: white;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 2rem;
}

.feature-module {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  position: relative;
}

.feature-module:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.module-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.module-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.module-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  flex: 1;
}

.module-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.module-badge.hot {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.module-badge.new {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.module-badge {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.module-description {
  font-size: 1rem;
  color: #4a5568;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.module-preview {
  margin-bottom: 1.5rem;
}

.preview-image {
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.preview-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #a0aec0;
}

.preview-icon {
  font-size: 2rem;
}

.module-features {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.feature-tag {
  padding: 0.25rem 0.75rem;
  background: rgba(139, 92, 246, 0.1);
  color: #7C3AED;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.module-actions {
  display: flex;
  gap: 1rem;
}

.action-btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.action-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.action-btn.secondary {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.3);
}

.action-btn.secondary:hover {
  background: rgba(102, 126, 234, 0.15);
}

/* 快速操作区域 */
.quick-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.recent-works, .quick-actions {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.section-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 1.5rem;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.recent-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.recent-item:hover {
  transform: translateY(-4px);
}

.recent-thumbnail {
  position: relative;
  height: 120px;
  overflow: hidden;
}

.recent-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.recent-item:hover .recent-overlay {
  opacity: 1;
}

.overlay-btn {
  padding: 0.5rem 1rem;
  background: white;
  color: #2d3748;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.overlay-btn:hover {
  background: #f7fafc;
}

.recent-info {
  padding: 1rem;
  background: white;
}

.recent-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.recent-time {
  font-size: 0.8rem;
  color: #a0aec0;
  margin-bottom: 0.5rem;
}

.recent-type {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: rgba(139, 92, 246, 0.1);
  color: #7C3AED;
  border-radius: 12px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(139, 92, 246, 0.05);
  border: 2px solid rgba(139, 92, 246, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-item:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.quick-icon {
  font-size: 2rem;
}

.quick-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a5568;
}

/* 产品特色 */
.highlights-section {
  margin-top: 2rem;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.highlight-item {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.highlight-item:hover {
  transform: translateY(-4px);
}

.highlight-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.highlight-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.75rem;
}

.highlight-desc {
  font-size: 0.95rem;
  color: #4a5568;
  line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .welcome-section {
    grid-template-columns: 1fr;
  }
  
  .quick-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .home-container {
    padding: 1rem;
  }
  
  .main-content {
    gap: 2rem;
  }
  
  .welcome-content {
    padding: 2rem;
  }
  
  .welcome-title {
    font-size: 2rem;
  }
  
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .recent-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .quick-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  
  .recent-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .highlights-grid {
    grid-template-columns: 1fr;
  }
}
</style> 
